-
Notifications
You must be signed in to change notification settings - Fork 237
Introducing script debugging support #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This change introduces debugging support to both the core .NET library and the out-of-process API host. It adds a new DebugService class to the API and all of the necessary messages that are specified by VS Code's debugging protocol. This change also marks a refactoring of runspace management logic in the core API. Previously the runspace used by a few different services was interacted with directly, which complicated the process for executing commands and scripts when the debugger was active. A new PowerShellSession class has been introduced to provide complete management of the runspace(s) needed for a single editing session. In the future, this class will expand to support remote sessions as well.
This change redesigns the existing MessageReader and MessageWriter classes to read/write messages using Streams instead of TextReader/TextWriter classes. This makes the host process compatible with VS Code's latest debugger client so that messages sent from it can be read correctly. It also sets us up for being able to communicate through other types of streams such as sockets.
This changes improves debugger variable support by allowing the enumeration of the children of "expandable" variables (objects and collections) and the requesting of variable scopes. The variable scope feature will be completed in a future commit.
In more recent VS Code builds, diagnostic message levels have been shifted from being 1-based to 0-based. This fix responds to that change.
The first change fixes breakpoint removal. Previously, breakpoints were being tracked per-file based on the script's file path. It was discovered that file paths were being sent through the protocol with inconsistent casing, so path normalization was needed to ensure that breakpoints were being indexed with the correct path casing. The second change adds the "close" request for closing opened files. This request was not being used by VS Code previously but was suddenly getting sent in newer builds of that editor.
This change fixes scenario tests that were broken by the recent message serialization changes. First of all, the correct stdio streams were not being used in the test runner so no messages could be read or written. Secondly, the existing unit tests were not using 'await' on the async WriteMessage calls, so this was causing some trouble with their operation. Also, some existing tests around REPL support were disabled for now until future design changes are completed. We're waiting on new message support from VS Code's debug protocol.
- Send TerminatedEvent from debug service when script execution completes - Set VariableDetails value string to space when extendable (VS Code bug) - Add ExecutionPolicy setting for machines with higher default setting - Add extensive logging in PowerShellSession
This change adds a new log file for the debugging service called "DebugService.log". This log file will be taken back out once we have the debugging service running in the same process as the language service.
This change fixes a race condition in MessageWriter.WriteMessage where multiple calls to the method would end up writing at the same time. This is due to the use of 'await' calls and happens even when both calls occur on the same synchronization context. The subsequent calls proceed while the first call is awaiting the completion of I/O writes. The solution is to use an AsyncLock to synchronize I/O operations while allowing more messages to be queued up.
This change removes many subnamespaces that had been used in the core .NET library for this project. This should help with type discoverability when a developer is using IntelliSense. The only remaining subnamespace is "Utility" since those classes are not essential to typical usage of the library. This change may be reversed in the future if sufficient feedback is received that subnamespaces are helpful.
This change splits some small classes out into their own files for easier location. It also adds missing documentation for many new classes that were added when debugging support was introduced.
This change adds missing copy right headers in all new source files. It also introduces a new script, AddCopyrightHeaders.ps1, that automates the process of adding a copyright header to files which do not have one.
This changes updates the language service command completion tests to use a file with a .psm1 extension to ensure that this file type works correctly.
daviwil
added a commit
that referenced
this pull request
Nov 1, 2015
Introducing script debugging support
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces script debugging support in both the code .NET library and the API host process. It also includes a pretty thorough refactoring of the core library code to centralize runspace session management and improve the threading model. Many bugs have been fixed in the effort to prepare a prerelease preview, so stability is pretty good at this point.